<!doctype html>
<meta charset="utf8">
<title>CSS contain-intrinsic-size: grid auto-fit, min- max- size interactions</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#intrinsic-size-override">
<link rel="match" href="contain-intrinsic-size-026-ref.html">
<meta name="assert" content="auto-fit columns, with intrinsic-size interacting with min- and max- width">

<style>
.grid {
  display: inline-grid;
  border: 1px solid black;
  grid-template-columns: repeat(auto-fit, 100px);
  height: 40px;
}
.one {
  contain-intrinsic-size: 100px;
  contain: size;
  min-width: 200px;
}
.two {
  contain-intrinsic-size: 200px;
  contain: size;
  min-width: 100px;
}
.three {
  contain-intrinsic-size: 100px;
  contain: size;
  min-width: 200px;
  max-width: 150px;
}
.four {
  contain-intrinsic-size: 200px;
  contain: size;
  min-width: 100px;
  max-width: 150px;
}
.item {
  background: green;
  height: 100%;
}
</style>

<p>min-width larger than contain-intrinsic-width:
<div class="grid one">
  <div class="item">one</div>
  <div class="item">two</div>
</div>

<p>min-width smaller than contain-intrinsic-width:
<div class="grid two">
  <div class="item">one</div>
  <div class="item">two</div>
</div>

<p>max-width ignored since min-width is larger:
<div class="grid three">
  <div class="item">one</div>
  <div class="item">two</div>
</div>

<p>min-width shrinks grid since it overrides contain-intrinsic-width:
<div class="grid four">
  <div class="item">one</div>
  <div class="item">two</div>
</div>
